package com.jk.wh.service.impl;

import com.jk.CarouselBean;
import com.jk.wh.dao.CarouselDao;
import com.jk.wh.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarouselServiceImpl implements CarouselService {

    @Autowired
    private CarouselDao carouselDao;


    //轮播图查询
    @Override
    public List<CarouselBean> queryCarousel() {
        return carouselDao.queryCarousel();
    }

    //新增、修改轮播图
    @Override
    public void addCarousel(CarouselBean carousel) {
        if (carousel.getId() == null){//新增轮播图
            carouselDao.addCarousel(carousel);
        }else{//修改轮播图
            carouselDao.updateCarousel(carousel);
        }
    }

    //删除轮播图
    @Override
    public void del(int id) {
        carouselDao.del(id);
    }

    //修改回显
    @Override
    public CarouselBean upById(int id) {
        return carouselDao.upById(id);
    }
}
